layout.tsx 965 B

12345678910111213141516171819202122232425262728
  1. import { HomeLayout } from 'fumadocs-ui/layouts/home';
  2. import { baseOptions } from '@/lib/layout.shared';
  3. import { HomeLanguageSwitcher } from '@/components/home/language-switcher';
  4. export default async function Layout({ params, children }: LayoutProps<'/[lang]'>) {
  5. const { lang } = await params;
  6. const options = baseOptions(lang);
  7. return (
  8. <HomeLayout
  9. {...options}
  10. // Disable fumadocs' built-in popover language switcher here: nested in the
  11. // home navbar's Radix NavigationMenu its item clicks don't fire. We inject
  12. // an anchor-based one instead (see HomeLanguageSwitcher). Docs keep the
  13. // built-in switcher (its sidebar isn't a NavigationMenu, so it works).
  14. i18n={false}
  15. links={[
  16. ...(options.links ?? []),
  17. {
  18. type: 'custom',
  19. secondary: true,
  20. children: <HomeLanguageSwitcher current={lang} />,
  21. },
  22. ]}
  23. >
  24. {children}
  25. </HomeLayout>
  26. );
  27. }